package com.qidianit.mes.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @Author 奇幻夜之梦
 * @Company 起点编程
 * @Description
 * @Time 2024/10/16 0:22
 */
public class MaterialClassify {
    private Long classifyId; //物料分类编号
    private String classifyName; //物料分类名称
    private Integer classifyType; //默认1,1 产品，2 物料，物料 | 产品
    private Integer classifyOrder; //排序
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime; //创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date modifyTime; //最后修改时间
    private Integer classifyStatus; //默认1,1 正常，2 暂停 ,99 删除 | 物料分类状态
    private Integer classifyParent; //是否为顶级分类，1 是，2 否
    private Long classifyParentId; //父分类编号，默认 0 表示没有父分类

    private List<MaterialClassify> children;// 子分类列表
    private Boolean hasChildren; // 是否有子分类

    public Long getClassifyId() {
        return classifyId;
    }

    public void setClassifyId(Long classifyId) {
        this.classifyId = classifyId;
    }

    public String getClassifyName() {
        return classifyName;
    }

    public void setClassifyName(String classifyName) {
        this.classifyName = classifyName;
    }

    public Integer getClassifyType() {
        return classifyType;
    }

    public void setClassifyType(Integer classifyType) {
        this.classifyType = classifyType;
    }

    public Integer getClassifyOrder() {
        return classifyOrder;
    }

    public void setClassifyOrder(Integer classifyOrder) {
        this.classifyOrder = classifyOrder;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Integer getClassifyStatus() {
        return classifyStatus;
    }

    public void setClassifyStatus(Integer classifyStatus) {
        this.classifyStatus = classifyStatus;
    }

    public Integer getClassifyParent() {
        return classifyParent;
    }

    public void setClassifyParent(Integer classifyParent) {
        this.classifyParent = classifyParent;
        if(this.classifyParent.equals(new Integer(1))){
            this.hasChildren = true; // 如果是父级任务，说明有子任务，将hasChildren设置为true
        }
    }

    public Long getClassifyParentId() {
        return classifyParentId;
    }

    public void setClassifyParentId(Long classifyParentId) {
        this.classifyParentId = classifyParentId;
    }

    public List<MaterialClassify> getChildren() {
        return children;
    }

    public void setChildren(List<MaterialClassify> children) {
        this.children = children;
    }

    public Boolean getHasChildren() {
        return hasChildren;
    }

    public void setHasChildren(Boolean hasChildren) {
        this.hasChildren = hasChildren;
    }
}

